package com.example.barcodeapp.ui.wode.adapter;

import android.content.Context;
import android.graphics.Color;
import android.view.View;
import android.widget.TextView;

import androidx.constraintlayout.widget.ConstraintLayout;

import com.example.barcodeapp.R;
import com.example.barcodeapp.base.BaseAdapter;
import com.example.barcodeapp.ui.wode.bean.JifengBiChongZhiJinEBean;

import java.util.ArrayList;
import java.util.List;

public class ChongZhiAdapter extends BaseAdapter {
    private ArrayList<JifengBiChongZhiJinEBean> list;

    public ChongZhiAdapter(Context context, List data) {
        super(context, data);
    }

    @Override
    protected int getLayout() {
        return R.layout.layout_rec_item_chongzhi;
    }

    @Override
    protected void bindData(BaseViewHolder vh, Object data) {
        TextView mTvYuan = (TextView) vh.getViewById(R.id.tv_yuan);
        TextView mTvJiFengBi = (TextView) vh.getViewById(R.id.tv_jifengbi);
        ConstraintLayout mConstraintLayout = (ConstraintLayout) vh.getViewById(R.id.constraintLayout);
        JifengBiChongZhiJinEBean.DataEntity chongZhiBean = (JifengBiChongZhiJinEBean.DataEntity) data;
        mTvYuan.setText(chongZhiBean.getMoney() + "元");
        mTvJiFengBi.setText(chongZhiBean.getJifenbi() + "季风币");
        if (chongZhiBean.isSelect()) {
            mConstraintLayout.setBackgroundResource(R.drawable.shape_bg_rec_item1);
            mTvYuan.setTextColor(Color.parseColor("#E65D2E"));
        } else {
            mConstraintLayout.setBackgroundResource(R.drawable.shape_bg_rec_item);
            mTvYuan.setTextColor(Color.parseColor("#333333"));
        }
    }
}
